<?php 
require('lib/PHPPost.class.php');
$url = $_POST['url'];
$params = $_POST['params'];
$method = $_POST['method'];

if($method == 'POST'){
	$params_array = array();
	$array = explode('&', $params);
	if(is_array($array)){
		foreach($array as $item){
			$item_array = explode('=', $item);
			$key = $item_array[0];
			$value = @$item_array[1];
			$params_array[$key] = $value;
		}
	}
	$result = PHPPost::post($url, $params_array, 'form');
}else if($method == 'GET'){
	if(strpos($url,'?') === false){
		$url .= '?'.$params;
	}else{
		$url .= '&'.$params;
	}
	
	$result = file_get_contents($url);
}else{
	exit('非法的请求类型');
}

echo $result;

?>